package com.hao.user.app.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hao.user.app.model.dto.user.*;
import com.hao.user.app.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hao.user.app.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author haoge
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2023-05-21 09:22:40
*/
public interface UserService extends IService<User> {

    /**
     * 获取登录用户信息
     * @return
     */
    User getLoginUser();

    /**
     * 用户注册
     * @param userRegisterRequest
     * @return
     */
    boolean userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 用户登录
     * @param userLoginRequest
     * @param request
     * @return
     */
    User userLogin(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 添加用户  仅管理员可操作
     * @param userAddRequest
     * @return
     */
    boolean addUser(UserAddRequest userAddRequest);

    /**
     * 用户退出登录
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 更新用户
     * @param userUpdateRequest
     * @param request
     * @return
     */
    boolean updateUser(UserUpdateRequest userUpdateRequest, HttpServletRequest request);

    /**
     * 分页查询用户
     * @param userQueryRequest
     * @return
     */
    Page<UserVO> listUserByPage(UserQueryRequest userQueryRequest);

    /**
     * 扣减余额
     * @param id
     * @param totalNum
     * @return
     */
    boolean decreaseBalance(Long id, Double totalNum);

}
